package remote.skins
{
	import remote.controls.Component;
	import remote.skins.brushes.SolidBrush;
	
	
	/**
	 * 纯色矩形皮肤
	 * @author 银魂飞雪
	 * @createDate 2011-2-27
	 */
	public class SolidRectangleSkin extends SkinBase implements ISkin
	{
		private var _brush:SolidBrush;
		
		/**
		 * 实例化纯色矩形皮肤
		 * @param target 使用此皮肤的对象
		 * @param brush 纯色画笔，如果设置为空，则使用默认画笔
		 * 
		 */		
		public function SolidRectangleSkin(brush:SolidBrush = null)
		{
			super();
			if(brush == null)
				_brush = new SolidBrush(0xffffff, 0.8, 0, 1, 1);
			else
				_brush = brush;
		}
		
		public function draw(target:Component):void
		{
			target.graphics.clear();
			target.graphics.lineStyle(brush.borderThickness, brush.borderColor, brush.borderAlpha, true);
			target.graphics.beginFill(brush.backgroundColor, brush.backgroundAlpha);
			target.graphics.drawRect(0, 0, target.width - brush.borderThickness, target.height - brush.borderThickness);
			target.graphics.endFill();
		}
		
		/**
		 * 画笔 
		 * 
		 */		
		public function get brush():SolidBrush
		{
			return _brush;
		}

		public function set brush(value:SolidBrush):void
		{
			_brush = value;
		}

	}
}